function [X,Y,Z,r] = ProducePlotMesh(net,z,ranges)

layer = net.layers{1};
x = layer.positions(1,:);
y = layer.positions(2,:);
%z = NormalizeData(z);

dim = layer.dimensions(1);

X = [];
Y = [];
Z = [];
r = [];
for i = 1:dim,
    X = [X;x((i*dim-dim+1):(i*dim))];
    Y = [Y;y((i*dim-dim+1):(i*dim))];
    Z = [Z;z((i*dim-dim+1):(i*dim))];
    r = [r;ranges((i*dim-dim+1):(i*dim))];
end

end